package com.zz.bid.mapper;

import com.zz.bid.entity.Bid;
import com.zz.bid.to.BidTO;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @author chenkehan
 * created at 2020/4/4  6:26 下午
 */
@Mapper
public interface BidMapper {

    @Insert("insert into op_bid(name,openDate,hasTechnicalBid,principal,apartment,depositFile,depositSource,bidFile,auditor,winBid,refundInfo) " +
            "values(#{dto.name},#{dto.openDate},#{dto.hasTechnicalBid},#{dto.principal},#{dto.apartment},#{dto.depositFile},#{dto.depositSource},#{dto.bidFile},#{dto.auditor},#{dto.winBid},#{dto.refundInfo})")
    void createBid(@Param("dto") BidTO bidTO);

    @Select("select id,name,openDate,hasTechnicalBid,principal,apartment,depositFile,depositSource,bidFile,auditor,winBid,refundInfo from op_bid " +
            "where 1=1 <if test='dto.name != null and dto.name != \"\"'>and name LIKE CONCAT('%',#{dto.name},'%') </if>")
    List<Bid> search(@Param("dto") BidTO bidTO);
}
